Skip to content
This repository was archived by the owner on Dec 19, 2025. It is now read-only.

ENH: add suppport for Kokkos::complex Views#61

Merged
IvanGrigorik merged 14 commits intokokkos:mainfrom
NaderAlAwar:kokkos_complex
Nov 11, 2025
Merged

ENH: add suppport for Kokkos::complex Views#61
IvanGrigorik merged 14 commits intokokkos:mainfrom
NaderAlAwar:kokkos_complex

Conversation

@NaderAlAwar
Copy link
Copy Markdown
Contributor

This PR adds support for creating Views of type Kokkos::complex<float> and Kokkos::complex<double>. It also exposes these types to Python such that they can be created and used normally.

@JBludau
Copy link
Copy Markdown
Contributor

JBludau commented Nov 8, 2025

This might actually be a pretty useful change (especially since quantum computing simulation basically works mainly with complex matrix computation)

@IvanGrigorik
Copy link
Copy Markdown
Collaborator

I fixed some problems, that were related to tests itself and to atomics comparison

Comment thread src/complex_dtypes.cpp
Comment thread src/complex_dtypes.cpp Outdated
@IvanGrigorik IvanGrigorik merged commit 2d8f478 into kokkos:main Nov 11, 2025
42 checks passed
Comment on lines +141 to +143
// Only bind ordering operators for non-complex types
if constexpr (!is_complex<value_type>::value) {
_atomic.def(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx ... this actually is a problem we still have in core ... complex has only a subset of the operations implemented ...

Comment thread src/complex_dtypes.cpp

register_complex_as_numpy_dtype<float>();
register_complex_as_numpy_dtype<double>();
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be fixed !!! We should not merge anything that contains these @gliga @IvanGrigorik
Probably best to check your text editors/IDEs for how they end a file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this check is important, why don't we include the check as part of our CI

IvanGrigorik added a commit that referenced this pull request Nov 14, 2025
* ENH: add suppport for Kokkos::complex Views

* ENH: register Kokkos::complex as a numpy dtype

* ENH: bind remaining arithmetic operators for complex numbers

* ENH: read dtype properly for complex dtypes

* ENH: properly format views with complex data types

* ENH: fix issue with getting Kokkos::complex offsets when CUDA is enabled

* FIX: add back if condition checking for float64 (removed by accident)

* complex: fix comples type tests and conversion

* fix atomics

* formatting

* fix atomics comparison

* c++ formatting

* version: update kokkos version in the comment

---------

Co-authored-by: JBludau <104908666+JBludau@users.noreply.github.com>
Co-authored-by: Ivan Grigorik <givan502@gmail.com>
IvanGrigorik added a commit that referenced this pull request Nov 16, 2025
* ENH: add suppport for Kokkos::complex Views

* ENH: register Kokkos::complex as a numpy dtype

* ENH: bind remaining arithmetic operators for complex numbers

* ENH: read dtype properly for complex dtypes

* ENH: properly format views with complex data types

* ENH: fix issue with getting Kokkos::complex offsets when CUDA is enabled

* FIX: add back if condition checking for float64 (removed by accident)

* complex: fix comples type tests and conversion

* fix atomics

* formatting

* fix atomics comparison

* c++ formatting

* version: update kokkos version in the comment

---------

Co-authored-by: Nader Al Awar <naderalawar@gmail.com>
Co-authored-by: JBludau <104908666+JBludau@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants